New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Undefined symbol: json_object_from_file #2
Comments
Well, it's there in the current code so if you're using a recent build that should work. If you run ldd on the fuu binary, does it find the right json library? |
I don't remember exactly what append and I lost the binary but: #define JSON_MAJOR 0 I'm on archlinux x86_64 with kernel 3.0 When I nm the lib, I have : edit: I can't do another test with fuu right now but if you want, I'll can try to find this old project. |
That looks like you're running nm on a static library, but the commands from your original message imply that you were using a shared library. (if you were using a static library there, the gcc command to link the fuu binary would have failed). Also, json-c does not have JSON_MAJOR or JSON_MINOR defines. Are you sure you're using the right json library? For instance, there's a completely different (and somewhat simpler) project called "libjson" that has the same name for the library as json-c, so perhaps you're getting the wrong one linked in. If you run ldd on your fuu binary it should tell you the full path to the libjson.so it uses. Then you can use rpm or whatever package manager is present on your system to check what package that library is from. |
Well, I'm assuming this was just an issue of linking against the wrong library, so I'm going to close this. However, refer over to Issue #5 for possible improvements to avoid problems like this in the future. |
All is already in the title, I just can put an example below:
➜ cfuu git:(master) make
gcc -W -Wall -pedantic -ansi -Wshadow -Werror -g -I/usr/local/include -c -o fuu.o fuu.c
gcc fuu.o -o fuu -L/usr/local/lib -ljson
➜ cfuu git:(master) ✗ ./fuu
./fuu: symbol lookup error: ./fuu: undefined symbol: json_object_from_file
I can assure that libraries are in /usr/local/lib and include <json/json.h> in /usr/local/include
The text was updated successfully, but these errors were encountered: